
import 'package:dio/dio.dart';
import 'package:wechat_manager/utils/log_util.dart';

import '../../utils/preferences_util.dart';

class RequestInterceptor extends Interceptor {

  @override
  Future<void> onRequest(RequestOptions options, RequestInterceptorHandler handler) async {
    String accessToken  = await PreferencesUtil.getAccessToken();
    Map<String, dynamic> params = {"access_token" : accessToken};
    params.addAll(options.queryParameters);
    options.queryParameters = params;
    handler.next(options);
  }
}